<?php

// $Id: vpage_301_form_ctrl.class.php 1570 2009-01-13 12:44:02Z ogrebg $

require_once(TANGRA_MAIN_DIR.'form/gform_ctrl_with_obj.class.php');

require_once('vpage_301_form.class.php');
require_once('vpage_301_form_view.class.php');

require_once($WSC->get_site_inc_dir().'modules/tangra_cms/classes/vpt/vpage_301_dbc.class.php');


class VPage_301_Form_Ctrl extends GForm_Ctrl_With_Object {
	protected function create_form() {
		$form = new VPage_301_Form();

//		$form->generate_html();
		return $form;
	}


	protected function create_form_view() {
		$ret = new VPage_301_Form_View($this->form);

		return $ret;
	}


	protected function on_good_submit() {
		$ret = true;

		return $ret;
	}


	protected function create_object() {
		$object = new VPage_301_DBC();

		return $object;
	}


	protected function transfer_obj2form() {
		$object = $this->get_object();
		$form = $this->get_form();

		$form->set_field_value('location', $object->get_location());
	}


	protected function transfer_form2obj() {
		$object = $this->get_object();
		$form = $this->get_form();

		$object->set_location($form->get_field_value('location'));
	}


	protected function _save_object(DB_Connection $dbc, I_DB_Storable $object) {
		$object->save($dbc, $this->get_permanent_external_param('user_id'));
	}
}